package org.adoxx.adows.client; import java.net.MalformedURLException; import java.net.URL; import javax.xml.rpc.ServiceException; import com.boc_eu.adoweb.adows.client.AdoWSStub; /** * @author wutz * * Wrapper implementation for the webservice following a classic * singleton pattern. The wrapper creates the binding to the ADOxx * service and provides access to the binding * */ public class ADOxxWebService { private static ADOxxWebService service = null; private static com.boc_eu.adoweb.adows.client.AdoWSStub binding = null; /** * Protected constructor to setup the singleton instance and create the * service binding * * @param ADOxxWSEndpointURL * @throws MalformedURLException * @throws ServiceException */ protected ADOxxWebService(String ADOxxWSEndpointURL) throws MalformedURLException, ServiceException { binding = (com.boc_eu.adoweb.adows.client.AdoWSStub) new com.boc_eu.adoweb.adows.client.AdoWSLocator().getAdoWS(new URL(ADOxxWSEndpointURL)); } /** * Returns a application-wide unique instance of the service * * @param ADOxxWSEndpointURL * : String representation of the endpoint * @return {@link ADOxxWebService} */ public static ADOxxWebService getInstance(String ADOxxWSEndpointURL) { if (service == null) { try { service = new ADOxxWebService(ADOxxWSEndpointURL); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return service; } /** * Provides access to the service binding * * @return {@link AdoWSStub} */ public AdoWSStub getBinding() { return binding; } }